
//
//  MusicCollectionViewCell.m
//  FNer
//
//  Created by 王展 on 15/10/13.
//  Copyright (c) 2015年 wangzhan. All rights reserved.
//

#import "MusicCollectionViewCell.h"
#import "UIImageView+WebCache.h"

@implementation MusicCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createMusicCell];
    }
    return self;
}

-(void)createMusicCell
{
    self.pic = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 172 * XWIDTH, 180 * XHIGHT)];
    self.pic.backgroundColor = [UIColor colorWithRed:240 / 255.0 green:240 / 255.0 blue:240 / 255.0 alpha:1];
    [self.contentView addSubview:self.pic];
    
    self.name = [[UILabel alloc] initWithFrame:CGRectMake(0 * XWIDTH, 180 * XHIGHT, 172 * XWIDTH, 30 * XHIGHT)];
    [self.contentView addSubview:self.name];
    self.name.textColor = [UIColor lightGrayColor];
    self.name.font = [UIFont systemFontOfSize:15 * XWIDTH];
//    self.name.backgroundColor = [UIColor redColor];
}

-(void)setAmusic:(Music *)amusic
{
    _amusic = amusic;
    [self.pic sd_setImageWithURL:[NSURL URLWithString:self.amusic.pic]];
    self.name.text = self.amusic.name;
}

@end
